//获取智能计算平台组织机构-Hook
import { ref, onMounted } from 'vue';
import { CameraDetail } from '/@/api/its/camera.ts'
import {DetailItemType, ExtraInfoType} from '../types/cameraType.ts'
export function useItemDetail(props: any){
    let { id, ctx } = props
    const data = ref<DetailItemType>({
        extraInfo: {} as ExtraInfoType
    } as DetailItemType)
    const getData = async () => {
        let res: any = null
        try {
            res = await CameraDetail({id});
        }catch(error) {
            setTimeout(() => {
                ctx.emit('close','error')
            }, 500)
            return
        }
        data.value = res.data
    }
    onMounted(async () => {
        await getData()
    })
    return {
        data
    }
}
